package com.foreveross.fetl.core.domain.freight;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import com.dayatang.domain.InstanceFactory;
import com.foreveross.fetl.common.domain.BaseEntity;
import com.foreveross.fetl.core.domain.freight.repository.ICrawlTaskTemplateRepository;

@Entity
@Table(name="crawl_task_template")
public class CrawlTaskTemplateEntity extends BaseEntity {
	private static final long serialVersionUID = 489058574685820836L;
	@Id
	@Column(name="ID")
	private Integer id;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name="NAME")
	private String name; //名称
	
	@Column(name="FROM_CITY")
	private String fromCity; //时间 
	
	@Column(name="TO_CITY")
	private String toCity;//路径
	
	@Column(name="GRAB_CHANNEL")
	private String grabChannel; // 生成日期str
	
	@Column(name="FREQUENCY")
	private Integer frequency;//航空公司 code
	
	@Column(name="NEXT_GRAB_TIME")
	private Timestamp nextGrabTime; //timestamp
	
	@Column(name="PRIORITY")
	private Integer priority;
	
	@Column(name="GRAB_SCOPE_END")
	private Integer grabScopeEnd;
	
	@Column(name="FROM_CITY_NAME")
	private String fromCityName;
	
	@Column(name="TO_CITY_NAME")
	private String toCityName;
	
	@Column(name="VALIDITY_TO")
	private Date validityTo;
	
	@Column(name="VALIDITY_FROM")
	private Date validItyFrom;
	
	@Column(name="REMARK")
	private String remark;
	
	@Column(name="USER_ID")
	private Integer userId;
	
	@Column(name="CREATE_TIME")
	private Date createTime;
	
	@Column(name="STATUS")
	private Integer status;
	
	@Column(name="AREA_CODE")
	private String areaCode;
	
	@Column(name="AREA_NAME")
	private String areaName;
	
	@Column(name="USER_NAME")
	private String username;
	
	@Column(name="RETURN_DATE_SCOPE")
	private Integer returnDateScope;
	
	@Column(name="GRAB_SCOPE_BEGIN")
	private Integer grabScopeBegin;
	
	@Column(name="GRAB_CHANNEL_ID")
	private Integer grabChannelId;
	
	@Column(name="IS_RETURN")
	private Integer isReturn;
	
	@Column(name="ATTACH_HBASE_KEY")
	private String attachHbaseKey;
	
	@Column(name="IS_INTERNATIONAL")
	private Integer isInterNational;

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getFromCity() {
		return fromCity;
	}
	public void setFromCity(String fromCity) {
		this.fromCity = fromCity;
	}
	public String getToCity() {
		return toCity;
	}
	public void setToCity(String toCity) {
		this.toCity = toCity;
	}
	public String getGrabChannel() {
		return grabChannel;
	}
	public void setGrabChannel(String grabChannel) {
		this.grabChannel = grabChannel;
	}
	public Integer getFrequency() {
		return frequency;
	}
	public void setFrequency(Integer frequency) {
		this.frequency = frequency;
	}
	public Timestamp getNextGrabTime() {
		return nextGrabTime;
	}
	public void setNextGrabTime(Timestamp nextGrabTime) {
		this.nextGrabTime = nextGrabTime;
	}
	public Integer getPriority() {
		return priority;
	}
	public void setPriority(Integer priority) {
		this.priority = priority;
	}
	public Integer getGrabScopeEnd() {
		return grabScopeEnd;
	}
	public void setGrabScopeEnd(Integer grabScopeEnd) {
		this.grabScopeEnd = grabScopeEnd;
	}
	public String getFromCityName() {
		return fromCityName;
	}
	public void setFromCityName(String fromCityName) {
		this.fromCityName = fromCityName;
	}
	public String getToCityName() {
		return toCityName;
	}
	public void setToCityName(String toCityName) {
		this.toCityName = toCityName;
	}
	public Date getValidityTo() {
		return validityTo;
	}
	public void setValidityTo(Date validityTo) {
		this.validityTo = validityTo;
	}
	public Date getValidItyFrom() {
		return validItyFrom;
	}
	public void setValidItyFrom(Date validItyFrom) {
		this.validItyFrom = validItyFrom;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public Integer getUserId() {
		return userId;
	}
	public void setUserId(Integer userId) {
		this.userId = userId;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	public String getAreaCode() {
		return areaCode;
	}
	public void setAreaCode(String areaCode) {
		this.areaCode = areaCode;
	}
	public String getAreaName() {
		return areaName;
	}
	public void setAreaName(String areaName) {
		this.areaName = areaName;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public Integer getReturnDateScope() {
		return returnDateScope;
	}
	public void setReturnDateScope(Integer returnDateScope) {
		this.returnDateScope = returnDateScope;
	}
	public Integer getGrabScopeBegin() {
		return grabScopeBegin;
	}
	public void setGrabScopeBegin(Integer grabScopeBegin) {
		this.grabScopeBegin = grabScopeBegin;
	}
	public Integer getGrabChannelId() {
		return grabChannelId;
	}
	public void setGrabChannelId(Integer grabChannelId) {
		this.grabChannelId = grabChannelId;
	}
	public Integer getIsReturn() {
		return isReturn;
	}
	public void setIsReturn(Integer isReturn) {
		this.isReturn = isReturn;
	}
	public String getAttachHbaseKey() {
		return attachHbaseKey;
	}
	public void setAttachHbaseKey(String attachHbaseKey) {
		this.attachHbaseKey = attachHbaseKey;
	}
	public Integer getIsInterNational() {
		return isInterNational;
	}
	public void setIsInterNational(Integer isInterNational) {
		this.isInterNational = isInterNational;
	}
	
	public ICrawlTaskTemplateRepository getCrawlTaskTemplateRepository(){
		return InstanceFactory.getInstance(ICrawlTaskTemplateRepository.class);
	}
	
	public List<CrawlTaskTemplateEntity> getCrawlTaskTemplateList(String name) {
		return getCrawlTaskTemplateRepository().getCrawlTaskTemplateList(name);
	}
	
	public CrawlTaskTemplateEntity findByCondition(String attachHbaseKey, String fromCity, String toCity) {
		return getCrawlTaskTemplateRepository().findByCondition(attachHbaseKey, fromCity, toCity);
	}
}
